package com.fzdy.dataplatform.dao.impl;

import com.fzdy.dataplatform.core.dao.impl.BaseDaoImpl;
import com.fzdy.dataplatform.dao.DeviceDao;
import com.fzdy.dataplatform.entity.Device;
import com.google.common.base.Joiner;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class DeviceDaoImpl extends BaseDaoImpl<Device> implements DeviceDao {

    @Override
    public List<Device> getListBySnList(List<String> listSn) {
        String allSn = Joiner.on("','").skipNulls().join(listSn);
        String sql = "from Device where sn in ('" + allSn + "')";
       return this.getSession().createQuery(sql).list();
    }
}
